package com.bookshop.vo;

import com.bookshop.book.logic.Book;
import com.bookshop.promotion.logic.DiscountCoupons;
import com.bookshop.promotion.logic.EqualCoupons;
import com.bookshop.promotion.logic.PersonalPromotion;
import com.bookshop.user.identify.UserIdentity;
import com.bookshop.user.logic.CustomerInfo;
import com.bookshop.user.logic.User;

public class RegisterVO implements ValueObject {
	private static final long serialVersionUID = 6500044304379825104L;

	private String account;
	private String password;

	private String name;
	private String phoneNumber;
	private String address;

	public void update(String pAccount, String pPassword, String pName, String pPhoneNumber, String pAddress) {
		name = pName;
		phoneNumber = pPhoneNumber;
		address = pAddress;
	}

	public User creatCustomer() {
		UserIdentity userIdentity = UserIdentity.CUSTOMER;
		Book[] collectionBooks = new Book[0];
		EqualCoupons[] equalCoupons = {new EqualCoupons(0, 0)};
		DiscountCoupons[] discountCoupons = {new DiscountCoupons(0, 0)};
		PersonalPromotion promotionInfo = new PersonalPromotion(0, equalCoupons, discountCoupons);
		CustomerInfo customerInfo = new CustomerInfo(account, name, phoneNumber, address, collectionBooks, promotionInfo);
		return new User(account, password, userIdentity, customerInfo);
	}

}
